<?php
/**
 * Created by PhpStorm.
 * User: Cao
 * Date: 03/10/2014
 * Time: 10:31
 */

class Order extends CI_Controller
{

    public function __construct()
    {
        parent::__construct();
        $this->load->model("order_model");
        $this->load->helper("url");
    }

    public function index()
    {
        $show= $this->uri->segment(3);
        if ($show==NULL)
        {

                $data['title']="Danh sách Order";
                $data['path']="order/list";
                $data['list']=$this->order_model->getOrder();
                $this->load->view("index",$data);

        }
        else{
            if ($show="bytime")
            {
                $data['title']="Danh sách Order";
                $data['path']="order/list";
                $date1=$this->uri->segment(4);
                $date2=$this->uri->segment(5);
                $data['list']=$this->order_model->SortDate($date1,$date2);
                $this->load->view("index",$data);
            }
            else{
                $data['title']="Danh sách Order";
                $data['path']="order/list";
                $data['list']= $this->order_model->getOrderlimit($show);
                $this->load->view("index",$data);
            }

        }
    }
}